<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@page%>
<html>
<head>
<link href="common/common.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="common/sortabletable.js"></script>
<script type="text/javascript" src="common/common.js"></script>
<title></title>
</head>
<body>
<div id="leftlayout"><html:form action="/CommonFileUploadAction"
	enctype="multipart/form-data">
	<html:hidden property="relatedTo" />
	<html:hidden property="topic" />
	<input type="hidden" name="retValue" id="retValue">
	<table class="input-table" width="500" align="center">
		<thead>
			<tr>
				<td colspan="2">选择文件上传
				<div style="text-align: left; color: red"><html:errors /></div>
				</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>

				<div>选择文件： <html:file property="uploadFile" size="50"
					styleClass="textbox" />
				<p>强制覆盖已有文件 ：<html:checkbox property="forceUpload" value="true" />
				</div>
				</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="2">
				<div><input type="submit" class="button" name="action"
					value="上传" /></div>
				</td>
			</tr>
		</tfoot>
	</table>
	<p><c:set var="relatedFilesKey">${fileUploadForm.map.topic}:${fileUploadForm.map.relatedTo}</c:set>
	<!-- 调用myAppToolService 获取附件wenjian列表　--> <ct:call
		object="${springctx.myAppToolService}" method="getRelatedFileInfos"
		param1="${relatedFilesKey}" return="relatedFiles" /> <c:set
		var="allFileNames" value="" /> <c:if
		test="${relatedFiles!=null && !empty relatedFiles}">
		<table class="sort-table" width="500" align="center" id="filelist">
			<thead>
				<tr>
					<td>文件名称</td>
					<td>文件大小</td>
					<td>操作</td>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="fileInf" items="${relatedFiles}">
					<c:set var="allFileNames">${fileInf.fileName};${allFileNames}</c:set>
					<tr>

						<td>
						<p align="center"><a
							href="<c:url value='/CommonFileDownloadAction.do'><c:param name='fileName' value='${fileInf.fullName}'/></c:url>"
							target="_blank"><c:out value="${fileInf.fileName}" /></a></p>
						</td>
						<td>
						<p align="center"><c:out value="${fileInf.strSize}" /></p>
						</td>
						<td>
						<p align="center"><img src="images/delete.gif" title="删 除"
							class="btnImg"
							onclick="javascript:confirmClick('是否删除文件:${fileInf.fileName}','<c:url value="CommonFileUploadAction.do?action=删除&selectFileId=${fileInf.id}"/>')" />
						</p>
						</td>

					</tr>
				</c:forEach>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="3"></td>
				</tr>
			</tfoot>
		</table>
	</c:if>
</html:form></div>
<script type="text/javascript">
document.getElementById("retValue").value='${allFileNames}';
<c:if
		test="${relatedFiles!=null && !empty relatedFiles}">
var st = new SortableTable( document.getElementById("filelist"), ["String", "String","None"],'#E4EEF7','white','#FF9900');
</c:if>
</script>
</body>
</html>
